DataFrame divide
DataFrame.divide(other, axis='columns', level=None, fill_value=None)
Get Floating division of dataframe
Equivalent to dataframe / other
, but with support to substitute a fill_value for missing data in one of the inputs.
Among flexible wrappers (add, sub, mul, div, mod, pow) to arithmetic operators: +, -, , /, //, %, *.
Parameters :
other : scalar, sequence, Series, or DataFrame
axis : {0 or ‘index’, 1 or ‘columns’}
Whether to compare by the index (0 or ‘index’) or columns (1 or ‘columns’). For Series input, axis to match Series index on.
fill_value : float or None, default None
Fill existing missing (NaN) values, and any new element needed for successful DataFrame alignment, with this value before computation. If data in both corresponding DataFrame locations is missing the result will be missing.
返回值 : DataFrame
final
result = final.divide(final['当月新增'],axis = 0).iloc[:,1:]
result['当月新增'] = final['当月新增']
result
final.divide([10, 100, 1000, 10000, 100000], axis=0).iloc[:, 1:]